package com.base.cn.platform.os.service.course.agent.income;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 所有推广员收益详情Service
 *
 * @author LIZHIPENG
 * @create 2018-05-12 上午 11:41
 */
@FeignClient(name = CourseBaseService.appName, configuration = FeignAuthConfig.class)
public interface AgentIncomeInfoService extends CourseBaseService {

    /**
     * 查询收益明细列表（分页）
     * @param currentPage 页码
     * @param params 条件
     * @param userData 是否设置用户数据（true：是，false：否）
     * @param shopData 是否设置商品数据（true：是，false：否）
     * @return
     */
    @RequestMapping(contextPath + "/queryIncomeInfoListPage")
    Map<String, Object> queryIncomeInfoListPage(@RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,
                                                @RequestBody Map<String, Object> params,
                                                @RequestParam("userData") boolean userData,
                                                @RequestParam("shopData") boolean shopData);

    /**
     * 计算用户可结算的收益总和
     * @param userId 用户ID
     * @return 可结算收益
     */
    @RequestMapping(contextPath + "/countAvailableIncome")
    double countAvailableIncome(@RequestParam("userId") BigDecimal userId);

    /**
     * 保存推广员收益数据列表
     * @param agentIncomeInfoList 收益列表
     */
    @RequestMapping(contextPath + "/saveAgentIncomeInfo")
    void saveAgentIncomeInfo(@RequestBody List<Map<String, Object>> agentIncomeInfoList);
}
